package com.yema.retrofittest.Http

import com.yema.retrofittest.dataclass.ServerInfoResponse
import com.yema.retrofittest.dataclass.UploadFileModel
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.*


interface UrlApi {
    @GET("/get")
    fun get(@Query("id") id: Int): Call<ServerInfoResponse>

    //下载文件
    @Streaming
    @GET("/note/youdaonote_android_6.5.1_youdaoweb.apk")
    fun downFile(): Call<ResponseBody>

    //下载文件
    @Streaming
    @GET
    fun downFile(@Url url: String): Call<ResponseBody>

    @Streaming //大文件时要加不然会OOM
    @GET
    fun downloadFile(@Url fileUrl: String): Call<ResponseBody>

    @Multipart
    @POST("/myUploadFile")
    fun uploadFileWithRequestBody3(@Part partList: List<MultipartBody.Part>): Call<UploadFileModel>


    //单文件上传+其它参数
    @POST("upload")
    fun oneFileUpload(@Body body: RequestBody): Call<ResponseBody>

    //上传json
    @Multipart
    @POST("/uploadJson")
    fun uploadJson(@Part("mobileNoInfo") mobileNoInfo: RequestBody, @Part("name") name: String): Call<ResponseBody>

    @POST("/uploadJson")
    fun uploadJson2(@Body mobileNoInfo: RequestBody): Call<ResponseBody>

    //多文件+参数
    @POST("/uploadMoreFile")
    fun uploadMoreFile(@Body body: RequestBody): Call<ResponseBody>


    ///测试新版Retrofit 2.6
    //获取分类
//    @POST("/intf/fileManage/questionFileClassifyList")
//    suspend fun questionFileClassifyList(): SortModel


}